Application#1: 
ArrayDemo2.java

Aim: To find the maximum value in an array of int values
Find the longest string in an array of String values

- Application#2: Frequencies.java

Input: line of text
Output: Find the nb of occurrences of lowercase/uppercase letters found in the input line of text + 
The number of occurrences of non-alphabetic characters in the input line of text

hi there
a: 0	A: 0 ---> idx = 0: a and A: 0 ---> 'a'   (char) (0 + 'a')
b: 0	B: 0 ---> idx = 1: b and B: 1 ---> 'b' (char) (1 + 'a')
...
e: 2	E: 0
...
z: 0	Z: 0 ---> idx = 25: z and Z: 25 ---> 'z'
Non-alphabetic: 1

lower ---> array of counters for lowercase letters
int[] lower = new int[26];

lower[0] ---> count the number of 'a's
lower[1] ---> count the number of 'b's

...
lower[25] ---> count the number of 'z's

current - 'a'

a ---> lower[0] should be updated; 'a' ----> 0 ===> 'a' - 'a' = 0
b ---> lower[1] should be updated; 'b' ----> 1 ===> 'b' - 'a' = 1
....
z ---> lower[25] should be updated; 'z' ----> 25 ===> 'z' - 'a' = 25


upper ---> array of counters for uppercase letters

current - 'A'


other ---> regular counter for non-alphabetic characters

53 variables ---> 3 variables

- main(String[] args)
 
Application#3: ArgsDemo.java


- Variable length parameter list

Objective: design a method that can process any number of parameters

sum(1, 2)
sum(1, 2, 3)
sum(1, 2, 3, 4)

Option#1: Create multiple versions of sum (Method overloading)

int sum(int num1, int num2) { return num1 + num2; }
int sum(int num1, int num2, int num3) { return num1 + num2 + num3; }

Option#2: Create a method that accepts as a parameter an array

int sum(int[] arr) {
	int result = 0;
	
	for(int value : arr) {
		result += value;
	}

	return result;
}

int arr = {1, 2};
sum(arr)

Option#3: Variable length parameter list

int sum(int... list) {
	int result = 0;

	for(int val : list) {
		result += val;
	}
	
	return result;
}


System.out.println(sum(1, 2)); // 3
System.out.println(sum(1, 2, 3)); // 6
System.out.println(sum()); // 0

foo(int val1, double val2, int... list)
foo(double... list1, int... list2) // invalid syntax

- Two dimensional arrays:

mat
0	1	2
10	11	12
20	21	22

int[][] mat = new int[3][3];

mat.length ---> # of rows = 3
mat[0].length ---> # of columns = 3
mat[1].length
mat[2].length

System.out.print(mat[1][1]); // 11
System.out.print(mat[mat.length - 1][mat[0].length - 1]); // 22

Application#4: TwoDArrayDemo.java

























